import 'package:flutter/material.dart';

// 简单封装的容器,参数为位置
class AligmentContainer extends StatelessWidget {
  
  const AligmentContainer({ Key key, this.child, this.dir }) : super(key: key);
  final Widget child;
  final String dir;

  Alignment getDir(String dir) {
    switch (dir) {
      case 'topLeft' : 
        return Alignment.topLeft;
        break;
      case 'bottomCenter': 
        return Alignment.bottomCenter;
        break;
      default:
        return Alignment.center; 
     }
   }
  @override
  Widget build(BuildContext context) {
    return  Container(
        color: const Color(0xFFFFFFFF),
        padding: const EdgeInsets.all(8.0),
        child: child,
        alignment: getDir(dir),
        width: 90.0,
        height: 90.0,
        margin: const EdgeInsets.all(20.0),
        transform: Matrix4.diagonal3Values(0.5, 0.5, 0.5)..rotateX(0.2)..rotateZ(0.2)
    );
  }

}